package com.aos.erp.schools.rpc.student;

import com.aos.erp.schools.model.student.ro.picture.ListByStudentRpcRo;
import com.aos.erp.schools.model.student.ro.student.AcceptStudentRo;
import com.aos.erp.schools.model.student.vo.picture.StudentPictureVo;
import com.aos.erp.schools.model.student.vo.picture.StudentPictureVo2;
import com.aos.erp.schools.model.student.vo.student.StudentAll2Vo;
import com.aos.erp.schools.model.student.vo.student.StudentAllVo;
import com.aos.erp.schools.service.student.StudentPictureService;
import com.aos.erp.schools.service.student.StudentService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.LinkedList;
import java.util.List;

/**
 * @Auther: chb
 * @Date: 2018/11/15 17:18
 * @Description: 内网审核结果详情列表
 */
@RestController
@RequestMapping("/service/studentIntranet")
@Api(tags = {"内网导入导出查询"})
public class StudentImportServiceController {

    @Autowired
    private StudentService studentService ;

    @Autowired
    private StudentPictureService studentPictureService;

    @PostMapping("/importStudent")
    @ApiOperation(value = "学员导入")
    public boolean importStudent(List<AcceptStudentRo> ro)
    {
        //TODO      修改学员状态
        if(ro.size()<0)
        {
            return false;
        }


        return true;

    }


    @PostMapping("/exportStudent")
    @ApiOperation(value = "查询")
    public List<StudentAllVo>  exportStudent(@RequestBody  ListByStudentRpcRo ro)
    {
        List<StudentAllVo>  listVo=new LinkedList<>();
        for(int i=0;i<ro.getStudentId().size();i++)
        {
            List<StudentPictureVo> list=studentPictureService.selectPicture(ro.getStudentId().get(i));
            StudentAllVo student=studentService.queryObject(ro.getStudentId().get(i));
            student.setListStudentPicture(list);
            listVo.add(student);
        }
        return listVo;
    }
}
